package uml.view.panels;

import java.awt.Color;
import java.awt.Dimension;

import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;

import uml.util.UMLConstants;
import uml.util.listeners.DragListener;
import uml.view.UMLContainerView;

/**
 * A specialization of <tt>UMLContainerView</tt> to provide appropriate defaults for 
 * UML interface box objects.
 * 
 * @author Neil Obetz
 *
 */

public class InterfaceView extends UMLContainerView
{
	/**
	 * 
	 */
	private static final long serialVersionUID = -7576128187348021250L;
	
	private static Dimension m_size = UMLConstants.INTERFACE_SIZE;
	private static Color m_color = UMLConstants.INTERFACE_COLOR;
	private static int m_numberOfFields = 1;
	private BoxLayout layout = new BoxLayout (this, BoxLayout.Y_AXIS);
	private String m_name;
	
	/**
	 * Constructs a default InterfaceView
	 */
	
	public InterfaceView ()
	{
		super ();
		m_name = "Interface";
		Border border = BorderFactory.createTitledBorder (UMLConstants.INTERFACE_BORDER, m_name, TitledBorder.CENTER, TitledBorder.TOP);
		setBorder (border);
		setupProperties ();
	}
	
	/**
	 * A private method used to initialize default properties associated with InterfaceViews.
	 */
	
	private void setupProperties ()
	{
		setSize (m_size);
		setBackground (m_color);
		setLayout (layout);
		addFields (m_numberOfFields);
		addDragListener (new DragListener (this));
		setVisible (true);
	}
}
